package utils;

import java.net.URL;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;

import alon24sageexternaltools.Activator;

public class Util
{
    /**
     * Returns the image descriptor with the given relative path.
     */
    public static ImageDescriptor getImageDescriptor(String relativePath)
    {
        String iconPath = "icons/";
        // try
        // {
        URL url = FileLocator.find(Activator.getDefault().getBundle(),
                new Path(iconPath + relativePath), null);
        return ImageDescriptor.createFromURL(url);
    }

    public static String getDirectory()
    {
        URL url = FileLocator.find(Activator.getDefault().getBundle(),
                new Path(""), null);
        
        return url.getPath();
    }
}
